#include <iostream>
struct MyTest
{
    std::string msg;
    MyTest(std::string str) : msg(str){
        std::cout << "hello msg" << std::endl;
    }
    MyTest(){}
};

//只在c++11之前的版本中可以正常使用，11会警告，17直接弃用了
//void func() throw(int, double)

void func() noexcept(/*可以根据需要添加常量表达式，返回值为bool类型*/)
{
    try
    {
       // throw 1;
        throw 1.0d;
    }
    catch (int x1)
    {
        std::cout << "x1: " << x1 << std::endl;
    }
    catch (double x2)
    {
        std::cout << "x2: " << x2 << std::endl;
    }
    catch (MyTest msg)
    {
        //std::string s("hello ,world");
        //std::cout << "msg " << msg(s) << std::endl;
    }

}


int main()
{
    func();
    return 0;
}
